<?php
namespace app\common\model;



use think\Model;

class Recharge extends Model
{
    public function getList($where = []){
        return $this
            ->where($where)
            ->order('sort')
            ->paginate('',false,['query'=>request()->param()]);
    }


    public function getRows($map = [])
    {
        return $this
            ->where($map)
            ->field('id,price,money,first_price,give_explain,remark')
            ->order('sort')
            ->cache(5)
            ->select();
    }


    public function saveChange($data){
        if(is_numeric($data['id'])){
            return $this->validate(true)->allowField(true)->save($data,[$this->getPk()=>$data['id']]);
        }else{
            return $this->validate(true)->allowField(true)->save($data);
        }
    }
}